﻿@model Expenses.Models.InvoiceModel

@{
    ViewBag.Title = "Edit";
}

<h2>Edit</h2>

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

  <script type="text/javascript">
      $(document).ready(function () {
          $("#BillingDate, #ExpirationDate, #PaymentDate").datepicker();
          
      });
  </script>

  
@using (Html.BeginForm()) {
    @Html.ValidationSummary(true)
    
    <fieldset>
        <legend>Invoice</legend>

        @Html.HiddenFor(model => model.Id)
        
        <table width="80%">
            <tr>
                <td>
                    <div class="editor-label">
                        @Html.LabelFor(model => model.BillingDate)
                    </div>
                    <div class="editor-field">
                        @Html.EditorFor(model => model.BillingDate)
                        @Html.ValidationMessageFor(model => model.BillingDate)
                    </div>                
                </td>
                <td>
                    <div class="editor-label">
                        @Html.LabelFor(model => model.ExpirationDate)
                    </div>
                    <div class="editor-field">
                        @Html.EditorFor(model => model.ExpirationDate)
                        @Html.ValidationMessageFor(model => model.ExpirationDate)
                    </div>    
                </td>
                <td>
                    <div class="editor-label">
                        @Html.LabelFor(model => model.PaymentDate)
                    </div>
                    <div class="editor-field">
                        @Html.EditorFor(model => model.PaymentDate)
                        @Html.ValidationMessageFor(model => model.PaymentDate)
                    </div>
                </td>
            </tr>
            <tr>
                <td>
                    <div class="editor-label">
                        @Html.LabelFor(model => model.Amount)
                    </div>
                    <div class="editor-field">
                        @Html.EditorFor(model => model.Amount)
                        @Html.ValidationMessageFor(model => model.Amount)
                    </div>
                </td>
                <td>
                    <div class="editor-label">
                        @Html.LabelFor(model => model.IsPaid)
                    </div>
                    <div class="editor-field">
                        @Html.EditorFor(model => model.IsPaid)
                        @Html.ValidationMessageFor(model => model.IsPaid)
                    </div>
                </td>
                <td>
                    <div class="editor-field">
                        @*@Html.DropDownList("Id", new SelectList(Model.Expenses, "Id", "Name"))*@
                        @Html.DropDownListFor(model => model.Expense.Id, new SelectList(Model.Expenses, "Id", "Name", Model.Expense), "-- Select Expense --", new { style = "width:210px;" })
                        @*@Html.ValidationMessageFor(model => model.Expense)*@
                    </div>
                </td>
            </tr>
            <tr >
                <td style="text-align: right;" colspan="3">
                    <p>
                        <input type="submit" value="Save" />
                    </p>
                </td>
            </tr>
        </table>
    </fieldset>
}

<div>
    @Html.ActionLink("Back to List", "Index")
</div>
